package com.foreveross.proxyip.application.impl.pools;

import java.util.List;
import java.util.Vector;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.foreveross.proxyip.application.pool.ChannelPoolApplication;
import com.foreveross.proxyip.core.pools.ChannelPool;
import com.foreveross.proxyip.core.pools.PoolsManager;
import com.foreveross.proxyip.entity.ProxyIpBean;
import com.foreveross.proxyip.infra.PageData;
import com.foreveross.proxyip.util.PoolPageUtil;
@Service
public class ChannelPoolApplicationImpl implements ChannelPoolApplication {

	@Autowired
	PoolsManager poolsManager;
	/**
	 * 分页获取页面数据
	 * @param pageData
	 * @return
	 * @throws Exception 
	 */
	public PageData loadPageData(PageData pageData,String channelCode) throws Exception{
		List <ProxyIpBean> ips = new Vector<ProxyIpBean>();
		ChannelPool pool = poolsManager.getChannelPoolMap().get(channelCode);
//		for(ChannelPool pool:poolsManager.getChannelPoolMap().values()){
//			ips.addAll(ips.size(), pool.listAllIps());
//		}
		PoolPageUtil pagUtil = new PoolPageUtil();
		return pagUtil.loadPageData(pool, pageData);
	}
	
}
